<html>
<head><meta charset="utf-8"><title>Possible unsoundness in `futures::Map` · wg-async-foundations · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/index.html">wg-async-foundations</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Possible.20unsoundness.20in.20.60futures.3A.3AMap.60.html">Possible unsoundness in `futures::Map`</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="165424537"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Possible%20unsoundness%20in%20%60futures%3A%3AMap%60/near/165424537" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Possible.20unsoundness.20in.20.60futures.3A.3AMap.60.html#165424537">(May 11 2019 at 19:03)</a>:</h4>
<p><span class="user-mention" data-user-id="116155">@Jake Goulding</span>  pointed out a possible error in the <a href="https://github.com/rust-lang-nursery/futures-rs/blob/0.3.0-alpha.15/futures-util/src/future/map.rs#L36-L45" target="_blank" title="https://github.com/rust-lang-nursery/futures-rs/blob/0.3.0-alpha.15/futures-util/src/future/map.rs#L36-L45">implementation of <code>poll</code></a> in <code>future::Map</code> on Stack Overflow. I responded that I thought that <code>Map</code> must <a href="https://stackoverflow.com/a/56088431/11389321" target="_blank" title="https://stackoverflow.com/a/56088431/11389321">add an <code>F: Unpin</code> bound</a> to the <code>poll</code> implementation in order to be sound ( <code>F</code> is the type of the function passed to <code>Map</code>).</p>
<p>Does anyone with more knowledge of the pin API have an opinion on this? It feels like I'm missing something here.</p>



<a name="165424609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Possible%20unsoundness%20in%20%60futures%3A%3AMap%60/near/165424609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Possible.20unsoundness.20in.20.60futures.3A.3AMap.60.html#165424609">(May 11 2019 at 19:05)</a>:</h4>
<p><span class="user-mention" data-user-id="210267">@Nemo157</span> and I have also been <a href="https://discordapp.com/channels/442252698964721669/474974025454452766/576761828298981425" target="_blank" title="https://discordapp.com/channels/442252698964721669/474974025454452766/576761828298981425">discussing on Discord</a></p>



<a name="165425006"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Possible%20unsoundness%20in%20%60futures%3A%3AMap%60/near/165425006" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Possible.20unsoundness.20in.20.60futures.3A.3AMap.60.html#165425006">(May 11 2019 at 19:14)</a>:</h4>
<p>Hmm, so the guarantees of <code>Pin&lt;&amp;X&gt;</code> do not necessarily apply to the fields of <code>X</code> unless it is possible to create a <code>Pin</code> referencing one of those fields.</p>



<a name="165425186"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Possible%20unsoundness%20in%20%60futures%3A%3AMap%60/near/165425186" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Possible.20unsoundness.20in.20.60futures.3A.3AMap.60.html#165425186">(May 11 2019 at 19:18)</a>:</h4>
<p>Someone else should go get that bounty :)</p>



<a name="165425442"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Possible%20unsoundness%20in%20%60futures%3A%3AMap%60/near/165425442" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Possible.20unsoundness.20in.20.60futures.3A.3AMap.60.html#165425442">(May 11 2019 at 19:25)</a>:</h4>
<p>I encourage any and everyone to go for it <span aria-label="stuck out tongue wink" class="emoji emoji-1f61c" role="img" title="stuck out tongue wink">:stuck_out_tongue_wink:</span></p>



<a name="165551754"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Possible%20unsoundness%20in%20%60futures%3A%3AMap%60/near/165551754" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Taylor Cramer <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Possible.20unsoundness.20in.20.60futures.3A.3AMap.60.html#165551754">(May 13 2019 at 17:54)</a>:</h4>
<p>F does not need to be <code>Unpin</code></p>



<a name="165551768"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Possible%20unsoundness%20in%20%60futures%3A%3AMap%60/near/165551768" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Taylor Cramer <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Possible.20unsoundness.20in.20.60futures.3A.3AMap.60.html#165551768">(May 13 2019 at 17:54)</a>:</h4>
<p>Because it isn't pin-projected-to</p>



<a name="165568928"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Possible%20unsoundness%20in%20%60futures%3A%3AMap%60/near/165568928" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Possible.20unsoundness.20in.20.60futures.3A.3AMap.60.html#165568928">(May 13 2019 at 21:03)</a>:</h4>
<p><span class="user-mention" data-user-id="127859">@Taylor Cramer</span> If you'd like to contribute an answer, that would be wonderful (<a href="https://stackoverflow.com/q/56058494/155423" target="_blank" title="https://stackoverflow.com/q/56058494/155423">https://stackoverflow.com/q/56058494/155423</a>)</p>



<a name="165571026"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Possible%20unsoundness%20in%20%60futures%3A%3AMap%60/near/165571026" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Taylor Cramer <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Possible.20unsoundness.20in.20.60futures.3A.3AMap.60.html#165571026">(May 13 2019 at 21:30)</a>:</h4>
<p>unfortunately I don't have an SO account and don't have time to do that at the moment, but I can try and come back to it later</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>